from puremvc.patterns.facade import Facade
import controller


class AppFacade(Facade):
    STARTUP                     = "startup"
    HOME_STARTUP                = "home_startup"
    NEW_MP_STARTUP              = "new_mp_startup"
    VIEW_MP_NEW                 = "view_mp_new"
    ADD_MP                      = "add_mp"
    MP_ADDED                    = "mp_added"
    GET_MPS                     = "get_mps"
    MPS_GOT                     = "mps_got"
    GET_HOME                    = "get_home"
    HOME_GOT                    = "home_got"

    def __init__(self):
        self.send_notification(AppFacade.STARTUP)

    @staticmethod
    def get_instance():
        return AppFacade()

    def _init_controller(self):
        super(AppFacade, self)._init_controller()
        self._register_cmds()

    def _register_cmds(self):
        super(AppFacade, self).register_cmd(AppFacade.STARTUP, controller.StartupCmd)
        super(AppFacade, self).register_cmd(AppFacade.HOME_STARTUP, controller.HomeStartupCmd)
        super(AppFacade, self).register_cmd(AppFacade.NEW_MP_STARTUP, controller.NewMpStartupCmd)
        super(AppFacade, self).register_cmd(AppFacade.MPS_STARTUP, controller.MpsStartupCmd)
        super(AppFacade, self).register_cmd(AppFacade.ADD_MP, controller.AddMpCmd)
        super(AppFacade, self).register_cmd(AppFacade.GET_HOME, controller.GetHomeCmd)
        super(AppFacade, self).register_cmd(AppFacade.GET_MPS, controller.GetMpsCmd)
